// token键名
const KEY = 'vant-user-login-token'
const ISLIKE = 'isLike'
const ISSTAR = 'isStar'

// 获取token
export const getToken = () => {
  return localStorage.getItem(KEY)
}

// 设置token
export const setToken = (token) => {
  localStorage.setItem(KEY, token)
}

// 删除token
export const delToken = () => {
  localStorage.removeItem(KEY)
}

// 由于点赞和收藏后端没返回是否点赞和是否收藏  所以在此封装一个方法，将状态存在本地。
// 点赞
export const setIsLike = (isLike) => {
  localStorage.setItem(ISLIKE, JSON.stringify(isLike))
}
export const getIsLike = () => {
  return localStorage.getItem(ISLIKE)
}

// 收藏
export const setIsStart = (isStart) => {
  localStorage.setItem(ISSTAR, JSON.stringify(isStart))
}
export const getIsStart = () => {
  return localStorage.getItem(ISSTAR)
}
